# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[return context['menu'].type == 'tv_navigator'
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb765c6cc>}
nname: 268
n 268(None)[return None
]:
	i: 88(), 161(), 222(), 266(AE)
	o: 

nname: 266
n 266(None)[]:
	i: 211(f)
	o: 268(AE)

nname: 222
n 222(None)[MessageWindow(text=_('A favorite with that name already exists.'), title=title).show(timeout=5)
]:
	i: 211(t)
	o: 268()

nname: 211
n 211(<dummy_ex3> EXC_MATCH FilenameExistsError)[]:
	i: 151(f)
	o: 222(t), 266(f)

nname: 161
n 161(None)[MessageWindow(text=_('Error while creating the favorite.'), title=_('Error')).show(timeout=5)
]:
	i: 151(t)
	o: 268()

nname: 151
n 151(<dummy_ex3> EXC_MATCH CreateContainerError)[]:
	i: 85(except)
	o: 161(t), 211(f)

nname: 88
n 88(None)[mlist.create_playlist(container=favorites_root, name=name)
k.hide()
menu.back_to_root()
pygui_globs['menustack'].back_to_menu(menu)
]:
	i: 85(try)
	o: 268()

nname: 85
n 85(None)[]:
	i: 33(), 84()
	o: 88(try), 151(except)

nname: 84
n 84(None)[]:
	i: 0(t)
	o: 85()

nname: 33
n 33(None)[message = _('That name is not valid. Choose another one.')
MessageWindow(message, title, button=None).show(timeout=5)
return None
]:
	i: 0(f)
	o: 85()

nname: 0
n 0(name)[name = k._text.strip()
title = _("Can't use that name")
]:
	i: 
	o: 33(f), 84(t)

nname: 268
n 268(None)[return None
]:
	i: 88()
	o: 

nname: 88
n 88(None)[try:
	mlist.create_playlist(container=favorites_root, name=name)
	k.hide()
	menu.back_to_root()
	pygui_globs['menustack'].back_to_menu(menu)
except CreateContainerError:
	MessageWindow(text=_('Error while creating the favorite.'), title=_('Error')).show(timeout=5)
except:
	except FilenameExistsError:
		MessageWindow(text=_('A favorite with that name already exists.'), title=title).show(timeout=5)
]:
	i: 0(try)
	o: 268()

nname: 0
n 0(None)[name = k._text.strip()
title = _("Can't use that name")
if not name:
	message = _('That name is not valid. Choose another one.')
	MessageWindow(message, title, button=None).show(timeout=5)
	return None
]:
	i: 
	o: 88(try)

nname: 268
n 268(None)[return None
]:
	i: 0()
	o: 

nname: 0
n 0(None)[name = k._text.strip()
title = _("Can't use that name")
if not name:
	message = _('That name is not valid. Choose another one.')
	MessageWindow(message, title, button=None).show(timeout=5)
	return None
try:
	mlist.create_playlist(container=favorites_root, name=name)
	k.hide()
	menu.back_to_root()
	pygui_globs['menustack'].back_to_menu(menu)
except CreateContainerError:
	MessageWindow(text=_('Error while creating the favorite.'), title=_('Error')).show(timeout=5)
except:
	except FilenameExistsError:
		MessageWindow(text=_('A favorite with that name already exists.'), title=title).show(timeout=5)
]:
	i: 
	o: 268()

nname: 0
n 0(None)[name = k._text.strip()
title = _("Can't use that name")
if not name:
	message = _('That name is not valid. Choose another one.')
	MessageWindow(message, title, button=None).show(timeout=5)
	return None
try:
	mlist.create_playlist(container=favorites_root, name=name)
	k.hide()
	menu.back_to_root()
	pygui_globs['menustack'].back_to_menu(menu)
except CreateContainerError:
	MessageWindow(text=_('Error while creating the favorite.'), title=_('Error')).show(timeout=5)
except:
	except FilenameExistsError:
		MessageWindow(text=_('A favorite with that name already exists.'), title=title).show(timeout=5)
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb766496c>}
nname: 223
n 223(None)[kbd = KeyboardWindow(_('Name this favorite'), text=txt, confirm_action=__create)
kbd.show()
]:
	i: 186(), 210()
	o: 

nname: 210
n 210(None)[txt = _('New Favorite')
]:
	i: 180(f)
	o: 223()

nname: 186
n 186(None)[txt = _('New Favorite %i') % (others + 1)
]:
	i: 180(t)
	o: 223()

nname: 180
n 180(others)[]:
	i: 101(), 143(), 178(AE)
	o: 186(t), 210(f)

nname: 178
n 178(None)[]:
	i: 133(f)
	o: 180(AE)

nname: 143
n 143(None)[menu.back_to_root()
context['parent'].show_menu()
]:
	i: 133(t)
	o: 180()

nname: 133
n 133(<dummy_ex3> EXC_MATCH BrowseError)[]:
	i: 0(except)
	o: 143(t), 178(f)

nname: 101
n 101(None)[others = sum(<genexpr>(favorites_root.browse()))
]:
	i: 0(try)
	o: 180()

nname: 0
n 0(None)[from pygui.window import KeyboardWindow, MessageWindow
menu = context['menu']
mlist = markerlists().get(menu.universe)
favorites_root = HiddenRoot().get_child('TV Favorites', menu)
def __create(k):
	name = k._text.strip()
	title = _("Can't use that name")
	if not name:
		message = _('That name is not valid. Choose another one.')
		MessageWindow(message, title, button=None).show(timeout=5)
		return None
	try:
		mlist.create_playlist(container=favorites_root, name=name)
		k.hide()
		menu.back_to_root()
		pygui_globs['menustack'].back_to_menu(menu)
	except CreateContainerError:
		MessageWindow(text=_('Error while creating the favorite.'), title=_('Error')).show(timeout=5)
	except:
		except FilenameExistsError:
			MessageWindow(text=_('A favorite with that name already exists.'), title=title).show(timeout=5)
	return None

]:
	i: 
	o: 101(try), 133(except)

nname: 223
n 223(None)[kbd = KeyboardWindow(_('Name this favorite'), text=txt, confirm_action=__create)
kbd.show()
]:
	i: 133()
	o: 

nname: 133
n 133(None)[except BrowseError:
	menu.back_to_root()
	context['parent'].show_menu()
if others:
	txt = _('New Favorite %i') % (others + 1)
else:
	txt = _('New Favorite')
]:
	i: 0()
	o: 223()

nname: 0
n 0(None)[from pygui.window import KeyboardWindow, MessageWindow
menu = context['menu']
mlist = markerlists().get(menu.universe)
favorites_root = HiddenRoot().get_child('TV Favorites', menu)
def __create(k):
	name = k._text.strip()
	title = _("Can't use that name")
	if not name:
		message = _('That name is not valid. Choose another one.')
		MessageWindow(message, title, button=None).show(timeout=5)
		return None
	try:
		mlist.create_playlist(container=favorites_root, name=name)
		k.hide()
		menu.back_to_root()
		pygui_globs['menustack'].back_to_menu(menu)
	except CreateContainerError:
		MessageWindow(text=_('Error while creating the favorite.'), title=_('Error')).show(timeout=5)
	except:
		except FilenameExistsError:
			MessageWindow(text=_('A favorite with that name already exists.'), title=title).show(timeout=5)
	return None

try:
	others = sum(<genexpr>(favorites_root.browse()))
]:
	i: 
	o: 133()

nname: 223
n 223(None)[kbd = KeyboardWindow(_('Name this favorite'), text=txt, confirm_action=__create)
kbd.show()
]:
	i: 0()
	o: 

nname: 0
n 0(None)[from pygui.window import KeyboardWindow, MessageWindow
menu = context['menu']
mlist = markerlists().get(menu.universe)
favorites_root = HiddenRoot().get_child('TV Favorites', menu)
def __create(k):
	name = k._text.strip()
	title = _("Can't use that name")
	if not name:
		message = _('That name is not valid. Choose another one.')
		MessageWindow(message, title, button=None).show(timeout=5)
		return None
	try:
		mlist.create_playlist(container=favorites_root, name=name)
		k.hide()
		menu.back_to_root()
		pygui_globs['menustack'].back_to_menu(menu)
	except CreateContainerError:
		MessageWindow(text=_('Error while creating the favorite.'), title=_('Error')).show(timeout=5)
	except:
		except FilenameExistsError:
			MessageWindow(text=_('A favorite with that name already exists.'), title=title).show(timeout=5)
	return None

try:
	others = sum(<genexpr>(favorites_root.browse()))
except BrowseError:
	menu.back_to_root()
	context['parent'].show_menu()
if others:
	txt = _('New Favorite %i') % (others + 1)
else:
	txt = _('New Favorite')
]:
	i: 
	o: 223()

nname: 0
n 0(None)[from pygui.window import KeyboardWindow, MessageWindow
menu = context['menu']
mlist = markerlists().get(menu.universe)
favorites_root = HiddenRoot().get_child('TV Favorites', menu)
def __create(k):
	name = k._text.strip()
	title = _("Can't use that name")
	if not name:
		message = _('That name is not valid. Choose another one.')
		MessageWindow(message, title, button=None).show(timeout=5)
		return None
	try:
		mlist.create_playlist(container=favorites_root, name=name)
		k.hide()
		menu.back_to_root()
		pygui_globs['menustack'].back_to_menu(menu)
	except CreateContainerError:
		MessageWindow(text=_('Error while creating the favorite.'), title=_('Error')).show(timeout=5)
	except:
		except FilenameExistsError:
			MessageWindow(text=_('A favorite with that name already exists.'), title=title).show(timeout=5)
	return None

try:
	others = sum(<genexpr>(favorites_root.browse()))
except BrowseError:
	menu.back_to_root()
	context['parent'].show_menu()
if others:
	txt = _('New Favorite %i') % (others + 1)
else:
	txt = _('New Favorite')
kbd = KeyboardWindow(_('Name this favorite'), text=txt, confirm_action=__create)
kbd.show()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb766282c>}
nname: 0
n 0(None)[from __future__ import absolute_import
from wymedia.wmplus import BrowseError, CreateContainerError, FilenameExistsError
from pygui.item.mediaitem.core import Playlist, HiddenRoot
from pygui.shared import pygui_globs
from pygui.markerlist import markerlists
caption = 'Create a favorite with the marked items'
def is_compatible(context):
	return context['menu'].type == 'tv_navigator'

def execute(context):
	from pygui.window import KeyboardWindow, MessageWindow
	menu = context['menu']
	mlist = markerlists().get(menu.universe)
	favorites_root = HiddenRoot().get_child('TV Favorites', menu)
	def __create(k):
		name = k._text.strip()
		title = _("Can't use that name")
		if not name:
			message = _('That name is not valid. Choose another one.')
			MessageWindow(message, title, button=None).show(timeout=5)
			return None
		try:
			mlist.create_playlist(container=favorites_root, name=name)
			k.hide()
			menu.back_to_root()
			pygui_globs['menustack'].back_to_menu(menu)
		except CreateContainerError:
			MessageWindow(text=_('Error while creating the favorite.'), title=_('Error')).show(timeout=5)
		except:
			except FilenameExistsError:
				MessageWindow(text=_('A favorite with that name already exists.'), title=title).show(timeout=5)
		return None

	try:
		others = sum(<genexpr>(favorites_root.browse()))
	except BrowseError:
		menu.back_to_root()
		context['parent'].show_menu()
	if others:
		txt = _('New Favorite %i') % (others + 1)
	else:
		txt = _('New Favorite')
	kbd = KeyboardWindow(_('Name this favorite'), text=txt, confirm_action=__create)
	kbd.show()

]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7655c0c>}
from __future__ import absolute_import
from wymedia.wmplus import BrowseError, CreateContainerError, FilenameExistsError
from pygui.item.mediaitem.core import Playlist, HiddenRoot
from pygui.shared import pygui_globs
from pygui.markerlist import markerlists
caption = 'Create a favorite with the marked items'
def is_compatible(context):
	return context['menu'].type == 'tv_navigator'

def execute(context):
	from pygui.window import KeyboardWindow, MessageWindow
	menu = context['menu']
	mlist = markerlists().get(menu.universe)
	favorites_root = HiddenRoot().get_child('TV Favorites', menu)
	def __create(k):
		name = k._text.strip()
		title = _("Can't use that name")
		if not name:
			message = _('That name is not valid. Choose another one.')
			MessageWindow(message, title, button=None).show(timeout=5)
			return None
		try:
			mlist.create_playlist(container=favorites_root, name=name)
			k.hide()
			menu.back_to_root()
			pygui_globs['menustack'].back_to_menu(menu)
		except CreateContainerError:
			MessageWindow(text=_('Error while creating the favorite.'), title=_('Error')).show(timeout=5)
		except:
			except FilenameExistsError:
				MessageWindow(text=_('A favorite with that name already exists.'), title=title).show(timeout=5)
		return None

	try:
		others = sum(<genexpr>(favorites_root.browse()))
	except BrowseError:
		menu.back_to_root()
		context['parent'].show_menu()
	if others:
		txt = _('New Favorite %i') % (others + 1)
	else:
		txt = _('New Favorite')
	kbd = KeyboardWindow(_('Name this favorite'), text=txt, confirm_action=__create)
	kbd.show()

